package org.pattern.abstractFactory.util;

import org.pattern.abstractFactory.model.ActionFigure;
import org.pattern.abstractFactory.model.HeMan;
import org.pattern.abstractFactory.model.Skeletor;


public class MastersOfTheUniverseFactory implements ActionFigureFactory {

	@Override
	public ActionFigure createHero() {
		return new HeMan(generateHealth());
	}

	@Override
	public ActionFigure createVillain() {
		return new Skeletor(generateHealth());
	}
	
	private Integer generateHealth(){
		Integer health = (int) (Math.random() * ActionFigure.MAX_HEALTH);
		
		if(health < ActionFigure.MIN_HEALTH)
			health = ActionFigure.MIN_HEALTH;
		
		return health;
	}
}
